<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //  var p1 = new Promise(function(resolve,reject){
        //         if(异步处理成功了){
        //             resolve(成功的数据);
        //         }else {
        //             reject(失败的原因)
        //         }
        //     })

        //     p1.then(成功(resolve),失败(reject))

        var p1 = new Promise(function(resolve,reject){
            resolve(1);
        });

        p1.then(function(value){
            alert('成功了'+value);
        },function(){
            alert('失败了');
        })
    </script>
</head>
<body>
    
</body>
</html>
